package com.hiquety.tcb.handler;

import com.hiquety.tcb.entity.ClipboardItem;
import com.hiquety.tcb.ui.IndexUI;
import javafx.event.EventHandler;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.MouseEvent;

public class ListViewClickHandler implements EventHandler<MouseEvent> {
    @Override
    public void handle(MouseEvent event) {
        ClipboardItem selectedItem = IndexUI.listView.getSelectionModel().getSelectedItem();
        Clipboard clipboard = Clipboard.getSystemClipboard();
        ClipboardContent content = new ClipboardContent();
        content.putString(selectedItem.getContent());
        clipboard.setContent(content);
    }
}
